package com.systech.core.util.xml.xstream;

import com.systech.core.util.SimpleLogger;
import com.thoughtworks.xstream.mapper.Mapper;
import com.thoughtworks.xstream.mapper.MapperWrapper;

public class PackageStrippingMapper extends MapperWrapper{


	public PackageStrippingMapper(Mapper wrapped) {
		super(wrapped);
	}

	// called when XStream wants to get the name to use when serializing a
	// class.
	@SuppressWarnings("rawtypes")
	@Override
	public String serializedClass(Class type) {
		try {
			if(type == null){
				return null;
			}
			return type.getSimpleName(); // fully qualified classname
		}
		catch (Throwable e) {
			SimpleLogger.debug("Erro al obtener el nombre de la clase" +  type);
		}
		return null;
	}

}
